// Copyright (c)  YISH. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using NSQL.DateFormats;
using NSQL.Generator;
using NSQL.Resource;

namespace NSQL.Extensions
{
    [SuppressMessage("ReSharper", "UnusedMember.Global")]
    public static class SqlGeneratorSettingsExtensions
    {
        public static SqlGeneratorSettings SetDataBase(this SqlGeneratorSettings settings, IDatabaseInfo database)
        {
            settings.Database = database;
            return settings;
        }
        
        public static SqlGeneratorSettings EnableAutoAlias(this SqlGeneratorSettings settings)
        {
            settings.AutoAlias = true;
            return settings;
        }
        
        public static SqlGeneratorSettings DisableAutoAlias(this SqlGeneratorSettings settings)
        {
            settings.AutoAlias = false;
            return settings;
        }
        
        public static SqlGeneratorSettings EnableBraceJoin(this SqlGeneratorSettings settings)
        {
            settings.BraceJoin = true;
            return settings;
        }
        
        public static SqlGeneratorSettings DisableBraceJoin(this SqlGeneratorSettings settings)
        {
            settings.BraceJoin = false;
            return settings;
        }
        
        
                
        public static SqlGeneratorSettings EnableOptimization(this SqlGeneratorSettings settings)
        {
            settings.Optimized = true;
            return settings;
        }
        
        public static SqlGeneratorSettings DisableOptimization(this SqlGeneratorSettings settings)
        {
            settings.Optimized = false;
            return settings;
        }
        
        public static SqlGeneratorSettings EnableDelimiter(this SqlGeneratorSettings settings)
        {
            settings.Delimited = true;
            return settings;
        }
        
        public static SqlGeneratorSettings DisableDelimiter(this SqlGeneratorSettings settings)
        {
            settings.Delimited = false;
            return settings;
        }
        
        public static SqlGeneratorSettings SetCultureInfo(this SqlGeneratorSettings settings, CultureInfo cultureInfo)
        {
            settings.CultureInfo = cultureInfo;
            return settings;
        }
        
        public static SqlGeneratorSettings SetDatetimeFormatter(this SqlGeneratorSettings settings, IDatetimeFormatter formatter)
        {
            settings.DatetimeFormatter = formatter;
            return settings;
        }
        
        public static SqlGeneratorSettings SetDatabaseVersion(this SqlGeneratorSettings settings, Version version)
        {
            settings.DatabaseVersion = version;
            return settings;
        }
    }
}